function getCmsList(channel,pageNumber,pageSize,callback){
    var param = {
        channelId : channel,
        pageNumber:pageNumber,
        pageSize:pageSize
    }
    $.post(window.serviceUrl+"content/getContentList", param, callback, 'json');
}
function getCmsIndex(callback){
    var param = {
    }
    $.post(window.serviceUrl+"content/getCmsIndex", param, callback, 'json');
}
function getBanner(){
    getCmsList(window.CHANNEL.sylbt,1,10,function(data){
        if(data.rtnCode == "000000"){
            var list = data.responseData.records;
            var content = "";
            $.each(list, function(i, item){
                content += '<li>\n' +
                    '                    <a href="detail.html?id='+item.id+'&channel1=首页" target="_blank" title="">\n' +
                    '                        <img src="'+window.imgUrl+item.typesimgUrl+'" alt="">\n' +
                    '                    </a>\n' +
                    '                    <div class="banner-title"><a href=""></a>\n' +
                    '                    </div>\n' +
                    '                </li>'
            });
            $("#slider").html(content).responsiveSlides({
                auto: true,
                nav: true,
                speed: 500,
                timeout: 4000,
                pager: true,
                pause: true,
                pauseControls: true,
                namespace: "callbacks"
            });
        }
    });
}

function showCmsIndex(){
    getCmsIndex(function(data){
        if(data.rtnCode == "000000"){
            getXydt(data.responseData.xydtdt,data.responseData.xydtycbt);
            getJxky(data.responseData.jxky);
            getZtwz(data.responseData.ztwz);
            getXxzx(data.responseData.xxgk,data.responseData.jyzx);
            $("#xyfczt").find("img").attr("src",window.imgUrl+data.responseData.xyfcz[0].typesimgUrl).on("click",function(){
                window.open("detail.html?id="+data.responseData.xyfcz[0].id +"&channel1=校园.风采");
            });
            $("#xyfcyt").find("img").attr("src",window.imgUrl+data.responseData.xyfcy[0].typesimgUrl).on("click",function(){
                window.open("detail.html?id="+data.responseData.xyfcy[0].id +"&channel1=校园.风采");
            });
            $("#xyfczt").find("p").html(data.responseData.xyfcz[0].title);
            $("#xyfcyt").find("p").html(data.responseData.xyfcy[0].title);
            getXyfcsp(data.responseData.xyfcx);
        }
    });
}
function getXydt(list,list1){
    var content = "";
    $.each(list, function(i, item){
        content += '<li class="col-md-6 col-sm-6 col-xs-12">\n' +
            '                                                        <div class="item">\n' +
            '                                                            <div class="pic"><a href="detail.html?id='+item.id+'&channel1=学院动态"' +
            '                                                                    target="_blank" title="'+item.title+'"><img\n' +
            '                                                                        width="375" height="275" class="coverImg"\n' +
            '                                                                        alt="'+item.title+'"\n' +
            '                                                                        onerror="this.src=\'//images/nopic.jpg\'"\n' +
            '                                                                        src="'+window.imgUrl+item.typesimgUrl+'"></a>\n' +
            '                                                            </div>\n' +
            '                                                            <div class="text">\n' +
            '                                                                <h3><a href="detail.html?id='+item.id+'&channel1=学院动态" target="_blank"\n' +
            '                                                                        title="'+item.title+'">'+item.title+'</a></h3>\n' +
            '                                                                <div class="summary">'+item.description+'</div>\n' +
            '                                                            </div>\n' +
            '                                                        </div>\n' +
            '                                                    </li>';
    });
    $("#xydtdt").html(content);
    content = "";
    $.each(list1, function(i, item){
        content += '<li>\n' +
            '                                                    <div class="date">\n' +
            '                                                        <span class="d">'+item.releaseDate.substring(8,10)+'</span>\n' +
            '                                                        <span class="y">'+item.releaseDate.substring(0,7)+'</span>\n' +
            '                                                    </div>\n' +
            '                                                    <div class="text">\n' +
            '                                                        <h4><a href="detail.html?id='+item.id+'&channel1=学院动态" target="_blank">'+item.title +
            '                                                            </a></h4>\n' +
            '                                                        <p>'+item.description +'</p>\n' +
            '                                                    </div>\n' +
            '                                                </li>';
    });
    $("#xydtycbt").html(content);
}

function getJxky(list){
    var content = "";
    $.each(list, function(i, item){
        content += '<div class="l"><a target="_blank" href="detail.html?id='+item.id+'&channel1=教学科研">' +
            '<img class="_lazyload" src="'+window.imgUrl+item.typesimgUrl+'"></a></div>' +
            ' <div class="r" ><div class="h"><a target="_blank" href="detail.html?id='+item.id+'&channel1=教学科研">'+item.title +'</a>\n' +
            '</div><div class="p" ><p style="text-align: left">'+item.description  +
            '</p></div><div class="date"></div></div>';
    });
    $("#jxky").html(content);
}

function getZtwz(list){
    var content = "";
    $.each(list, function(i, item){
        content += '<div class="item"><div class="pic"'
            +'style="background-image:url('+window.imgUrl+item.typesimgUrl+');"></div>'
            +'<div class="tit">'
            +'  <div class="h">'+item.title+'</div>'
            +' </div>'
            +'  <span class="more1">查看更多</span> <a href="'+item.originUrl+'"target="_blank"></a>'
            +'</div>';
    });
    $("#ztwz").html(content);
}

function getXxzx(list,list2){
    var content = "";
    $.each(list, function(i, item){
        content += '<li>'
            +' <div class="date">'
            +' <span class="d">'+item.releaseDate.substring(8,10)+'</span>'
            +'  <span class="y">'+item.releaseDate.substring(0,7)+'</span>'
            +'  </div>'
            +' <div class="text">'
            +'  <h4><a href="detail.html?id='+item.id+'&channel1='+encodeURI('信息公开')+'" target="_blank">'+item.title+'</a></h4>'
            +' <p>'+item.description+'</p>'
            +' </div> </li>';
    });
    $("#xxgk").html(content);
    content = "";
    $.each(list2, function(i, item){
        content += '<li>'
            +' <div class="date">'
            +' <span class="d">'+item.releaseDate.substring(8,10)+'</span>'
            +' <span class="y">'+item.releaseDate.substring(0,7)+'</span>'
            +' </div>'
            +' <div class="text">'
            +'  <h4><a href="detail.html?id='+item.id+'&channel1=教育资讯" target="_blank">'+item.title+'</a></h4>'
            +' <p>'+item.description+'</p>'
            +' </div>'
            +' </li>';
    });
    $("#jyzx").html(content);
}

function getXyfcsp(list){
    var content = "";
    $.each(list, function(i, item){
        content += '<div class="swiper-slide col-lg-3 col-md-3 col-sm-3 col-xs-12 wow fadeInUpBig">'
            +'<a target="_blank" href="detail.html?id='+item.id+'&channel1=校园.风采"><div class="page-header clearfix">'
            +'<div style="position: relative" class="more pull-right">'
            +'<img src="'+window.imgUrl+item.typesimgUrl+'"/>'
            +'<div  class="videoname" style="font-size: 20px;color:#fff;position: absolute;transform: translate(-50%,-50%);left:50%;top:50%">'
            +' <img style="width: 30px" src="images/play.png" />'
            +' <p style="text-align: center">'+item.title+'</p></div>'
            +'</div>'
            +'</div></a>'
            +' </div>';
    });
    $("#xyfcx").html(content);
    $("#xyfcxMobile").html(content);

    var swiper = new Swiper('.swiper-containerxxx', {
        slidesPerView: 4,
        loop:true,
        autoplay: {
            delay: 2000,
            disableOnInteraction: false,
        },
        spaceBetween: 30,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
    });
    var swiper = new Swiper('.swiper-containerxx', {
        slidesPerView: 2,
        loop:true,
        autoplay: {
            delay: 2000,
            disableOnInteraction: false,
        },
        spaceBetween: 0,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
    });
}

